+2009-02-06 Matthias Clasen <mclasen@redhat.com>
+
+ Make the new GtkAction code work with PolicyKit-gnome's use of actions.
+
+ * gtk/gtkaction.c (gtk_action_[un]block_activate_from): Block
+ the action.
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_activatable_reset):
+ * gtk/gtktogglebutton. (gtk_toggle_button_activatable_reset):
+ * gtk/gtktoggletoolbutton.c (gtk_toggle_tool_button_activatable_reset):
+ Work with non-toggle actions without complaining.
+
+ * gtk/gtktoolbutton.c (gtk_tool_button_activatable_update): Updating
+ the icon-name should not remove the label.
+
+ * gtk/gtkimagemenuitem.c (activatable_update_icon_name): Also
+ update the image when the icon name is set to NULL.
+
2009-02-06 Matthew Barnes <mbarnes@redhat.com>
* gtk/gtklabel.c (gtk_label_set_label): Accept a NULL string.
g_return_if_fail (GTK_IS_ACTION (action));
- g_return_if_fail (GTK_IS_ACTION (action));
-
tmp = action->private_data->icon_name;
action->private_data->icon_name = g_strdup (icon_name);
g_free (tmp);
g_signal_handlers_block_by_func (proxy, G_CALLBACK (gtk_action_activate),
action);
+
+ gtk_action_block_activate (action);
}
/**
g_signal_handlers_unblock_by_func (proxy, G_CALLBACK (gtk_action_activate),
action);
+
+ gtk_action_unblock_activate (action);
}
static void
parent_activatable_iface->reset (activatable, action);
- if (!action)
+ if (!GTK_IS_TOGGLE_ACTION (action))
return;
gtk_action_block_activate (action);
image = gtk_image_menu_item_get_image (image_menu_item);
- if (GTK_IS_IMAGE (image) && icon_name &&
+ if (GTK_IS_IMAGE (image) &&
(gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_EMPTY ||
gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_ICON_NAME))
{
parent_activatable_iface->reset (activatable, action);
- if (!action)
+ if (!GTK_IS_TOGGLE_ACTION (action))
return;
button = GTK_TOGGLE_BUTTON (activatable);
parent_activatable_iface->reset (activatable, action);
- if (!action)
+ if (!GTK_IS_TOGGLE_ACTION (action))
return;
button = GTK_TOGGLE_TOOL_BUTTON (activatable);
button = GTK_TOOL_BUTTON (activatable);
if (strcmp (property_name, "short-label") == 0)
- {
- if (!gtk_action_get_stock_id (action) &&
- !gtk_action_get_icon_name (action))
- {
- gtk_tool_button_set_use_underline (button, TRUE);
- gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
- }
- }
+ gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
else if (strcmp (property_name, "stock-id") == 0)
- {
- if (gtk_action_get_stock_id (action))
- {
- gtk_tool_button_set_label (button, NULL);
- gtk_tool_button_set_icon_name (button, NULL);
- }
- gtk_tool_button_set_icon_widget (button, NULL);
- gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
- }
+ gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
else if (strcmp (property_name, "gicon") == 0)
{
const gchar *stock_id = gtk_action_get_stock_id (action);
}
else if (strcmp (property_name, "icon-name") == 0)
- {
- if (gtk_action_get_icon_name (action))
- {
- gtk_tool_button_set_label (button, NULL);
- gtk_tool_button_set_stock_id (button, NULL);
- }
- gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
- }
+ gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
}
static void